<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <title>Document</title>
</head>
<body>
    <div class="container-fluid"style="width:80%">
        <div style="height:30px;"></div>
        <div class="panel panel-default">
            <div class="panel-heading">订单审核列表</div>
            <div class="panel-body">
                <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>送水工编号</th>
                        <th>送水工名称</th>
                        <th>订单编号</th>
                        <th>纯净水</th>
                        <th>数量</th>
                        <th>客户姓名</th>
                        <th>审核</th>
                    </tr>
                </thead>
                <tbody>
                    {% for obj in queryset%}
                    <tr>
                        <td>{{obj.id}}</td>
                        <td>{{obj.wid}}</td>
                        <td>{{obj.wname}}</td>
                        <td>{{obj.oid}}</td>
                        <td>{{obj.pname}}</td>
                        <td>{{obj.num}}</td>
                        <td>{{obj.cname}}</td>
                        <td>
                            <input uid={{obj.oid}} type="button"value="通过"class="btn btn-primary btn-xs btn-pass">
                            <input uid={{obj.oid}} type="button"value="未通过"class="btn btn-primary btn-xs btn-no">
                            
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            </div>
          </div>
          <div class="clearfix"></div>
        <ul class="pagination"style="float:right">
            {{page_string}}
         </ul>
    </div>
    <script src="/static/js/jquery-3.6.0.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <script>
    $(function(){
            bindBtnPassEvent();
            bindBtnNoEvent();
        })
    function bindBtnPassEvent(){
        $('.btn-pass').click(function(){
            
            var currentId=$(this).attr("uid");
                $.ajax({
                    url:'/admin_pass/',
                    type:"get",
                    data:{
                        uid:currentId
                    },
                    dataType:"JSON",
                    success:function(res){
                        if(res.status){
                            
                            location.reload()
                        }else{
                            alert(status.error);
                        }
                    }
                })
            })
        
        }
    
    function bindBtnNoEvent(){
        $(".btn-no").click(function(){
            $.ajax({
            url:'/admin_no/',
            type:"get",
            data:{
                uid:$(this).attr("uid")
            },
            dataType:"JSON",
            success:function(res){
                if(res.status){
                    location.reload()       
                           
                }
                else{
                    alert(status.error);
                }
            }

        })
    
        })
        
           
    }
</script>
</body>
</html>



